/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.pretorius.question1.encapsulation.service.impl;

import java.math.BigDecimal;
import za.ac.cput.pretorius.question1.encapsulation.model.Account;
import za.ac.cput.pretorius.question1.encapsulation.service.TransferFunds;

/**
 *
 * @author griddy
 */
public class TransferFundImpl implements TransferFunds {

    @Override
    public boolean transferFunds(Account one, Account two,BigDecimal amt) {
        
        boolean decrease = one.decreaseBalance(amt);
        boolean increase = true;
        
        if(decrease)
            increase = two.increaseBalance(amt);
        
        return (increase && decrease);
        
    }
    
}
